<template>
	<view class="u-page">
		<view class="content">
			<view class="tasklist" v-if="tasklist.length > 0"  >
			<block v-for="(item,index) in tasklist" :key="index">
				<view class="post">
					<view class="group">
						<text>{{item.slProjectByPid.title}}</text>
						<text>￥{{item.slProjectStoreTaskByTid.reward}}</text>
					</view>
					<view class="group">
						<view class="">
							<view class="message" v-if="item.slProjectStoreTaskByTid.type ==1">金额任务：完成
								{{item.slProjectStoreTaskByTid.where1}} 消费
							</view>
							<view class="message" v-if="item.slProjectStoreTaskByTid.type ==2">订单任务：完成
								{{item.slProjectStoreTaskByTid.where1}} 单消费
							</view>
							<view class="message" v-if="item.slProjectStoreTaskByTid.type ==3">拉新任务：完成
								{{item.slProjectStoreTaskByTid.where1}} 充值
							</view>
							<view class="message" >昵称：{{item.slUserByUid.nickname}} 电话：{{item.slUserByUid.phone}}
							</view>
						</view>
						<view class="condition">
							<view v-if="item.completion =='1'">符合奖励条件</view>
							<view v-if="item.completion =='0'">不符合奖励条件</view>
						</view>
					</view>
					<view class="group time">
						{{item.createtime}}
					</view>
				</view>
				<view class="but-item">
					<button type="success" class="success" size="mini" plain="true" 
						v-if="item.status =='1'">审核通过</button>
					<button type="warn" class="refuse"  size="mini" plain="true"
						 v-if="item.status =='2'">审核拒绝</button>
				</view>
				</block>
			</view>
			<view class="noData" v-else>
				<view class="zanwu">暂无审核记录</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				userData:'',
				pid:'',
				tasklist:'',
			}
		},
		onLoad(e) {
			let user = uni.getStorageSync('userData');
			this.userData = user;
			this.pid = e.id
			this.message()
		},
		methods: {
			async message() {
				//系统消息
				const tasks = await this.GQL({
					"operationName": "allSlUserTasks",
					"query": "query allSlUserTasks($filter: SlUserTaskFilter) { allSlUserTasks(filter:$filter) { nodes { uid tid status pid id createtime completion slProjectByPid { title } slProjectStoreTaskByTid { tid where1 uid type online reward } slUserByUid { phone nickname } } } }",
					"variables": {
						"filter": {
							"pid": {
								"equalTo": this.pid
							},
							"isExamine": {
								'equalTo': "1"
							}
						}
					}
				})
				if (tasks.data.allSlUserTasks.nodes != '') {
					this.tasklist = tasks.data.allSlUserTasks.nodes
				}
				// console.log('1-----',tasks);
			}
		}
	}
</script>

<style lang="scss">


	.nodData {
		height: 60vh;
		// font-weight: 600;
		background-color: #FFFFFF;
		color: #aaaaaa;
		border-radius: 5px;
		box-shadow: 1px -2px 10px 6px rgba(0, 0, 0, 0.1);
		display: flex;
		align-items: center;
		justify-content: center;
		.zanwu{
			margin: 10px 0px;
			font-size: 15px;
			font-family: PingFangSC-Medium, PingFang SC;
			font-weight: 500;
			color: #767B8D;
			line-height: 16px;
		}
		.but{
			font-size: 14px;
			font-family: PingFangSC-Medium, PingFang SC;
		}
	}

	.content {
		// margin: 20px 16px;
		padding: 20px;

		.tasklist {
			// height: 140px;
			margin-bottom: 12px;
			background: #FFFFFF;
			border-radius: 5px;
			box-shadow: 1px -2px 10px 6px rgba(0, 0, 0, 0.1);

			.post {
				// margin: 10px;
				padding: 16px 14px;
				border-bottom: 1px solid #eeeeee;

				.group {
					display: flex;
					justify-content: space-between;
					margin: 6px 0;
				}

				.group:nth-child(1) {
					font-size: 16px;
					font-weight: 600;

					text:nth-child(2) {
						color: #C7171E;
					}

					text:nth-child(1) {
						color: #767B8D;
					}
				}

				.time {
					font-size: 12px;
					color: #767B8D;
				}

				.group:nth-child(2) {
					.message {
						font-size: 14px;
					}

					.condition {
						font-size: 12px;
						color: #9BA7C1;
					}
				}
			}

			.left-item {
				flex: 1;

				.title {
					font-size: 15px;
					font-family: PingFangSC-Medium, PingFang SC;
					font-weight: 500;
					color: #767B8D;
					line-height: 16px;
					padding: 16px 0px;
					overflow: hidden;
				}

				.message {
					font-size: 12px;
					font-family: PingFangSC-Regular, PingFang SC;
					font-weight: 400;
					color: #161E3E;
					line-height: 12px;
				}

				.time {
					font-size: 10px;
					font-family: PingFangSC-Regular, PingFang SC;
					font-weight: 400;
					color: #767B8D;
					line-height: 12px;
					padding: 10px 0px;
				}
			}

			.right-item {
				width: 30%;

				>view:nth-child(2) {
					font-size: 12px;
					color: #9BA7C1;
				}
			}

			.but-item {
				text-align: right;
				padding: 8px;

				.success {
					background-color: #02B327;
					color: #fff;
					border: 1px solid #02B327;
				}

				.refuse {
					margin: 0px 10px;
				}
			}
		}

	}
</style>
